fix(ffi): validate account seed lengths - #752
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds private seed-length validators, enforces 16-byte minimums for BLS and EdDSA derivation, keeps the BLS maximum at 64 bytes, and adds regression tests for null results and ChangesSeed-Length Validation
Estimated code review effort: 2 (Simple) | ~12 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@key-wallet-ffi/src/account_derivation_tests.rs`:
- Around line 282-292: The second negative test reuses the prior FFIError
(error) so a stale error.code can mask a missing error from
bls_account_derive_private_key_from_seed; before calling
bls_account_derive_private_key_from_seed for the long_seed test,
reinitialize/reset error (e.g., create a fresh FFIError/default or zeroed
instance) so the function must set it for the assert to be valid—ensure you
reset the same variable named error used with ffi_account and too_long prior to
the call and then assert error.code == FFIErrorCode::InvalidInput.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1d48f1d3-d750-4723-91a4-211dd0735532
📒 Files selected for processing (2)
key-wallet-ffi/src/account_derivation.rskey-wallet-ffi/src/account_derivation_tests.rs
b20ebe0 to
0d8f959
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #752 +/- ##
==========================================
- Coverage 74.76% 74.72% -0.05%
==========================================
Files 328 328
Lines 76593 76613 +20
==========================================
- Hits 57267 57251 -16
- Misses 19326 19362 +36
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
✅ Review complete (commit 0d8f959) |
|
CI note: the new red |
|
Ownership sweep follow-up: this PR looks ready for maintainer review. CodeRabbit approved the current head (0d8f959), Codecov/project and patch are green, and the Rust CI matrix is green; the remaining red |
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
0d8f959 to
94918c7
Compare
FFI account seed-length validation
Summary
slicing or deriving.
SLIP-10 contract.
leaving generic secp256k1 account seed behavior unchanged.
Validation
cargo fmt -- key-wallet-ffi/src/account_derivation.rs \ key-wallet-ffi/src/account_derivation_tests.rscargo test -p key-wallet-ffi --features eddsa,bls account_derivation -- \ --nocapture— 6 passedcode-review dashpay/rust-dashcore upstream/v0.42-dev \ fix-ffi-seed-length-validation "Validate key-wallet FFI BLS/EdDSA account \ seed lengths before slicing/deriving while preserving secp256k1 generic \ account seed behavior"— no significant issues found; recommendation:ship
Notes
Draft until human review marks it ready.
Summary by CodeRabbit
Bug Fixes
Tests